package sort.InsertSort_ShellSort;

public class ShellSort2 {

	public void sort(int[] a){
		
		int j=0;
		int temp=0;
		for (int inc=a.length/2; inc>0; inc/=2) {
			for (int i=inc;i<a.length; i++) {
				temp = a[i];
				for (j=i;j>=inc;j-=inc) {
					if(temp>a[j-inc]){
						a[j]=a[j-inc];
					}else{
						break;
					}
				} 
				a[j] = temp;
			}
		}	
	}
}
